package com.yihubang.taobaokotlin.ui.fragment

import android.view.View
import android.view.ViewGroup
import com.renchunlin.banner.BannerView
import com.yihubang.taobaokotlin.R
import com.yihubang.taobaokotlin.base.BaseFragment
import com.yihubang.taobaokotlin.model.LooperItem

/*
 * class title: 
 * Author by RenChunLin, Email 18957806320@163.com, Date on 2021/5/10.
 * PS: Not easy to write code, please indicate.
 */
class SearchFragment : BaseFragment() {

    private val mData = mutableListOf<LooperItem>()

    override fun initView(rootView: View) {

        initTestData()

        val banner: BannerView = rootView.findViewById(R.id.banner)
        banner.setData(object : BannerView.InnerPageAdapter() {
            override val getDateSize: Int
                get() = mData.size

            override fun getItemView(container: ViewGroup, itemPosition: Int): View {

            }

        }, object : BannerView.TitleBindListener {
            override fun getTitle(position: Int): String {
                return mData[position].title
            }

        })
    }

    private fun initTestData() {
        mData.add(LooperItem("标题1", R.mipmap.ic_launcher))
        mData.add(LooperItem("标题2", R.mipmap.ic_launcher))
        mData.add(LooperItem("标题3", R.mipmap.ic_launcher))
        mData.add(LooperItem("标题4", R.mipmap.ic_launcher))
        mData.add(LooperItem("标题5", R.mipmap.ic_launcher))
    }

    override fun getRootViewResId(): Int {
        return R.layout.fragment_search
    }

}